package com.yoso.service;


import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.thread.ThreadUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.cron.TaskExecutor;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.beans.ExceptionListener;
import java.util.Random;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.logging.LogManager;

@Service
@Slf4j
public class LogService {


    public void log() {
        log.info("info");
        log.warn("warn");
        log.debug("debug");
        log.error("error");
        Logger nnn = LoggerFactory.getLogger("nnn");
        nnn.error("觉得放大镜放大看");
    }

    @Async(value = "taskExecutor")
    public void thread() {
        String businessCode = RandomUtil.randomString(6);
        log.info("处理业务逻辑:{}", businessCode);
        ThreadUtil.sleep(10, TimeUnit.SECONDS);
        log.info("处理完成:{}", businessCode);
    }
}
